package com.springboot.demo.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.springboot.demo.common.customValidator.ListNotHasNull;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.Date;
import java.util.List;

/**
 * @author wubc683
 * @desc
 * @date 2021-07-27 16:07
 */
@Data
@NoArgsConstructor
public class Panel {
    @ApiModelProperty(value = "仪表盘id",required = true)
    @NotNull(message = "仪表盘id不能为null")
    private Long id;
    @ApiModelProperty(value = "仪表盘名称,最长16字符",required = true)
    @NotBlank(message = "仪表盘名称不能为null或空")
    @Length(max=16,message = "仪表盘名称长度超限")
    @Pattern(regexp = "^[\\u4E00-\\u9FA5a-zA-Z0-9_-]{6,32}$", message = "仪表盘名格式错误")
    private String name;
    @ApiModelProperty(value = "仪表盘类型，0：运营仪表盘，1：场景仪表盘")
    private Integer type;
    @ApiModelProperty("仪表盘创建日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createDate;
    @ApiModelProperty(value = "仪表盘是否系统默认自带的,true是系统自带，不能删除，false是用户自建的")
    private Boolean isDefault;
    @ApiModelProperty("地图信息")
    private MapData mapData;
    @ApiModelProperty("地图联动信息")
    private MapLinkedData mapLinkedData;
    @ApiModelProperty("报表列表")
    private List<TableData> tableData;

    public Panel(String name, Integer type,Date createDate, Boolean isDefault){
        this.name = name;
        this.type = type;
        this.createDate = createDate;
        this.isDefault = isDefault;
    }
}
